<template>
  <div>
    <div
      id="movie"
      v-for="item in hots"
      :key="item.id"
      @click="godetail(item.id)"
    >
      <div class="left">
        <img v-lazy="item.img.replace('/w.h/', '/')" />
        <div class="details">
          <h4>{{ item.nm }}</h4>
          <p>{{ item.cat }}</p>
          <p>{{ item.desc }}</p>
          <p>{{ item.showTimeInfo }}</p>
        </div>
      </div>
      <div class="right">
        <button
          class="btn"
          :style="{ background: item.showNum ? 'red' : '#33bfff' }"
        >
          <span>{{ item.showNum ? "购票" : "预售" }}</span>
        </button>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState, mapActions } from "vuex";
export default {
  data() {
    return {
      n:0
    };
  },
  computed: {
    ...mapState("data", ["hots"]),
  },
  mounted() {

    this.getAllHots(this.n);
  },
  methods: {
    ...mapActions("data", ["getAllHots", "getDetail","getCrews","getComment"]),
    godetail(Id) {
      this.getComment(Id);
      this.getCrews(Id);
      this.getDetail(Id);
      this.$router.push("/index/hot/" + Id);
    },

   
  },
 
};
</script>

<style  scoped>
#movie {
  display: flex;
  height: 1.2rem;
  margin-left: 0.15rem;
  border-bottom: 1px solid #ccc;
}
.left {
  width: 2.6rem;
  display: flex;
}
.left img {
  width: 0.8rem;
  height: 1rem;
  margin-top: 0.1rem;
}
.details {
  margin: 0.1rem 0 0 0.1rem;
}
.details h4 {
  width: 1.4rem;
  font-size: 0.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 0.09rem;
}
.details p {
  width: 1.4rem;
  font-size: 0.12rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 0.09rem;
  color: rgb(56, 51, 51);
}
.right {
  flex: 1;
  background-color: white;
  position: relative;
  margin-right: 0.03rem;
}

.btn {
  border-radius: 5px;
  width: 0.5rem;
  height: 0.3rem;
  background-color: rgb(13, 175, 216);
  color: #fff;
  position: absolute;
  top: 0.5rem;
  right: 0.1rem;
  font-size: 0.12rem;
}
</style>